observations
Class QuantityRange

java.lang.Object
  extended byobservations.QuantityRange

public class QuantityRange
extends java.lang.Object

QuantityRange two quantities building a range from to. For example '20 $ - 50 $'.

Version:
2004-09-10
Author:
Sascha Hemminger

Constructor Summary
QuantityRange(Quantity start, boolean isStartInclusive, Quantity end, boolean isEndInclusive)
          Basic constructor constructs a QuantityRange object.
QuantityRange(Quantity start, Quantity end)
          Constructs a QuantityRange object with upper and lower bound inclusive.
 
Method Summary
 boolean includes(Quantity value)
          Tests whether the quantity is in boundaries of the range.
static QuantityRange unlimited()
          Gives a range that has no lower and no upper bound which is infinity.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuantityRange

public QuantityRange(Quantity start,
                     boolean isStartInclusive,
                     Quantity end,
                     boolean isEndInclusive)
Basic constructor constructs a QuantityRange object.

Parameters:
start - lower bound of range, null if there is no lower bound
isStartInclusive - true if lower bound is inclusive
end - upper bound of range, null if there is no upper bound
isEndInclusive - true if upper bound is inclusive

QuantityRange

public QuantityRange(Quantity start,
                     Quantity end)
Constructs a QuantityRange object with upper and lower bound inclusive.

Parameters:
start - lower bound
end - upper bound
See Also:
QuantityRange(Quantity, boolean, Quantity, boolean)
Method Detail

unlimited

public static QuantityRange unlimited()
Gives a range that has no lower and no upper bound which is infinity.

Returns:
infinite range

includes

public boolean includes(Quantity value)
Tests whether the quantity is in boundaries of the range.

Parameters:
value - quantity to test
Returns:
true if quantity is included